<link href="/static/layui/css/layui.css" rel="stylesheet">
<form class="layui-form" id="reject_select_table">
<input style="display: none" name="id" id="id">

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">退选原因:</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入拒绝原因...." class="layui-textarea" name="remark"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit  id="submit_teacher_reject">立即提交</button>
        </div>
    </div>
</form>
<script src="/static/js/jquery-3.3.1.min.js"></script>
<script src="/static/js/ajax.js"></script>
<script src="/static/layui/layui.js" type="text/javascript"></script>
<script>
    layui.use('form', function(){
        var form = layui.form;
    });

    // 进行退选操作
    $("#submit_teacher_reject").click(function () {
        $.ajax({
            type: "PATCH",
            url: "/api/v1/teacher/rejectStudentSelected",
            dataType:"json",
            data: $("#reject_select_table").serialize(),
            success:function (data) {
             console.log(data);
                if(data.code==0 && data.msg=='success'){
                    let index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                }else{
                    layer.msg("退选学生失败")
                }
            }
        });
        // 阻止layui弹出层页面刷新
        return false;
    });
</script>